<template>
  <div class="tnb">
    <div class="query">
      <div>
        <span>管理单位：</span>
        <el-cascader
          size="small"
          @change="org_change"
          :options="jigou_1"
          :props="{
            label: 'Name',
            value: 'Id',
            children: 'Children',
            checkStrictly: true,
          }"
          clearable
        ></el-cascader>
        <span style="display: inline-block; margin-left: 8px">责任医生：</span>
        <el-input
          size="small"
          v-model="query.doctorName"
          style="width: 200px"
        ></el-input>
        <span style="display: inline-block; margin-left: 8px">查询时间：</span>
        <el-date-picker
          v-model="query.time"
          size="small"
          @change="time_change"
          type="daterange"
          range-separator="至"
          value-format="yyyy-MM-dd"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </div>
      <div style="margin: 10px 0">
        <span>人员状态：</span>
        <el-select v-model="query.status" placeholder="请选择" size="small">
          <el-option label="正常" value="0"> </el-option>
          <el-option label="失访" value="2"> </el-option>
          <el-option label="死亡" value="3"> </el-option>
        </el-select>
        <span style="display: inline-block; margin-left: 8px">签约状态：</span>
        <el-select v-model="query.signStatus" placeholder="请选择" size="small">
          <el-option label="全部" value="-1"> </el-option>
          <el-option label="在签" value="1"> </el-option>
          <el-option label="未签" value="0"> </el-option>
        </el-select>
        <span style="display: inline-block; margin-left: 8px">性别：</span>
        <el-select v-model="query.gender" placeholder="请选择" size="small">
          <el-option label="全部" value="-1"> </el-option>
          <el-option label="男" value="1"> </el-option>
          <el-option label="女" value="2"> </el-option>
        </el-select>
        <span style="display: inline-block; margin-left: 8px">年龄段：</span>
        <el-select v-model="query.ageType" placeholder="请选择" size="small">
          <el-option label="全部" value="-1"> </el-option>
          <el-option label="35岁以下" value="0"> </el-option>
          <el-option label="35-45岁" value="1"> </el-option>
          <el-option label="46-55岁" value="2"> </el-option>
          <el-option label="56-65岁" value="3"> </el-option>
          <el-option label="65岁以上" value="4"> </el-option>
        </el-select>
        <span style="display: inline-block; margin-left: 8px">健康体检：</span>
        <el-select v-model="query.bodyCheck" placeholder="请选择" size="small">
          <el-option label="全部" value="-1"> </el-option>
          <el-option label="已检" value="1"> </el-option>
          <el-option label="未检" value="0"> </el-option>
        </el-select>
      </div>
      <div>
        <span>姓名：</span>
        <el-input
          size="small"
          v-model="query.name"
          style="width: 200px"
        ></el-input>
        <span style="display: inline-block; margin-left: 8px">身份证号：</span>
        <el-input
          size="small"
          v-model="query.idCard"
          style="width: 200px"
        ></el-input>
        <span style="float: right"
          ><el-button size="small" @click="get_list">查询</el-button>
          <el-button size="small">刷新</el-button></span
        >
      </div>
    </div>
    <div class="main">
      <el-table
        :data="tableData"
        v-loading="isLoading"
        border
        style="width: 100%"
        height="550"
        :header-cell-style="{
          color: '#000',
          backgroundColor: 'rgb(157,201,210)',
          fontFamily: 'FangSong',
        }"
      >
        <el-table-column prop="姓名" align="center" label="姓名">
        </el-table-column>
        <el-table-column prop="所在县" align="center" label="所在县">
        </el-table-column>
        <el-table-column prop="乡镇街道" align="center" label="乡镇街道">
        </el-table-column>
        <el-table-column prop="村卫生室" align="center" label="村卫生院">
        </el-table-column>
        <el-table-column prop="责任医生" align="center" label="责任医生">
        </el-table-column>
        <el-table-column prop="身份证号" align="center" label="居民身份证号">
        </el-table-column>
        <el-table-column prop="性别" align="center" label="性别">
        </el-table-column>
        <el-table-column prop="出生日期" align="center" label="出生日期">
        </el-table-column>
        <el-table-column prop="年龄" align="center" label="年龄">
        </el-table-column>
        <el-table-column
          prop="医保慢病待遇"
          align="center"
          label="医保慢病待遇"
        >
        </el-table-column>
        <el-table-column
          prop="居民健康档案号"
          align="center"
          label="居民健康档案号"
        >
        </el-table-column>
        <el-table-column prop="现住址" align="center" label="现住址">
        </el-table-column>
        <el-table-column prop="联系电话" align="center" label="联系电话">
        </el-table-column>
        <el-table-column prop="人群分类" align="center" label="人群分类">
        </el-table-column>
        <el-table-column
          prop="纳入管理时间"
          align="center"
          label="纳入管理时间"
        >
        </el-table-column>
        <el-table-column
          prop="年度体检时间"
          align="center"
          label="年度体检时间"
        >
        </el-table-column>
        <el-table-column align="center" label="第一季度">
          <el-table-column align="center" label="常规随访">
            <el-table-column
              prop="第一季度[0].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第一季度[0].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访1">
            <el-table-column
              prop="第一季度[1].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第一季度[1].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访2">
            <el-table-column
              prop="第一季度[2].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第一季度[2].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
        </el-table-column>
        <el-table-column align="center" label="第二季度">
          <el-table-column align="center" label="常规随访">
            <el-table-column
              prop="第二季度[0].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第二季度[0].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访1">
            <el-table-column
              prop="第二季度[1].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第二季度[1].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访2">
            <el-table-column
              prop="第二季度[2].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第二季度[2].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
        </el-table-column>
        <el-table-column align="center" label="第三季度">
          <el-table-column align="center" label="常规随访">
            <el-table-column
              prop="第三季度[0].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第三季度[0].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访1">
            <el-table-column
              prop="第三季度[1].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第三季度[1].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访2">
            <el-table-column
              prop="第三季度[2].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第三季度[2].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
        </el-table-column>
        <el-table-column align="center" label="第四季度">
          <el-table-column align="center" label="常规随访">
            <el-table-column
              prop="第四季度[0].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第四季度[0].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访1">
            <el-table-column
              prop="第四季度[1].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第四季度[1].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="增加随访2">
            <el-table-column
              prop="第四季度[2].随访时间"
              align="center"
              label="随访时间"
            >
            </el-table-column>
            <el-table-column
              prop="第四季度[2].血压值"
              align="center"
              label="血压值(mmHg)"
            >
            </el-table-column>
          </el-table-column>
        </el-table-column>
        <el-table-column prop="转诊1" align="center" label="双向转诊（上转）">
        </el-table-column>
        <el-table-column prop="转诊2" align="center" label="双向转诊（下转）">
        </el-table-column>
        <el-table-column prop="人员状态" align="center" label="人员状态">
        </el-table-column>
        <el-table-column
          prop="家庭医生签约"
          align="center"
          label="家庭医生签约"
        >
        </el-table-column>
      </el-table>
    </div>
    <div class="page">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.currentPage"
        :page-sizes="[15, 20, 50, 100]"
        :page-size="page.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
      >
      </el-pagination>
    </div>
  </div>
</template>
  
  <script>
export default {
  data() {
    return {
      query: {
        orgId: 0,
        status: "0",
        signStatus: "-1",
        gender: "-1",
        ageType: "-1",
        bodyCheck: "-1",
        name: "",
        idCard: "",
      },
      page: {
        currentPage: 1,
        pageSize: 15,
        total: 1,
      },
      tableData: [],
      option_1: [],
      option_2: [],
      option_3: [],
      option: {},
      isLoading: false,
      jigou_1: [],
    };
  },
  mounted() {
    this.getJg();
  },
  methods: {
    getJg() {
      this.$get(baseUrl.mbIp + "/api/NPatient/GetOrganTree").then((res) => {
        this.jigou_1 = res.Data;
      });
    },
    org_change(val) {
      this.query.orgId = val[val.length - 1];
    },
    get_list() {
      var data = {
        currentPage: this.page.currentPage,
        pageSize: this.page.pageSize,
        filter: this.query,
      };
      this.isLoading = true;
      this.$post(baseUrl.mbIp + "/api/Data/GetGxbStandingBook", data)
        .then((res) => {
          this.isLoading = false;
          if (res.StatusCode != 200) {
            this.$notify.error({
              title: "错误",
              message: res.Errors,
            });
          }
          this.tableData = res.Data.PageList;
          this.page.total = res.Data.Total;
        })
        .catch((err) => {
          this.isLoading = false;
        });
    },
    time_change() {
      this.query.startTime = this.query.time[0];
      this.query.endTime = this.query.time[1];
    },
    handleSizeChange(val) {
      this.page.pageSize = val;
      this.get_list();
    },
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.get_list();
    },
  },
};
</script>
  
  <style scoped lang="scss">
.tnb {
  padding: 15px;
  .main {
    margin-top: 10px;
  }

  .page {
    text-align: right;
    margin-top: 15px;
  }
}
</style>